package repository;

import model.Hobby;
import model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HobbyRepository extends JpaRepository<Hobby, Long> {

    @Query("Select h FROM Hobby h WHERE h.user.id = :idUser")
    List<Hobby> getHobbiesByUser(@Param("idUser") long idUser);
}